using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.Messages.Entity
{
    [Table("VMessageQueue", null, "Wicresoft.Messages.ConnectionString")]
    public class VMessageQueue : ViewInfo
    {
        #region SQL column name consts
        public const string SQLCOL_MESSAGEID = "MessageID";
        public const string SQLCOL_CREATETIME = "CreateTime";
        public const string SQLCOL_MODULEID = "ModuleID";
        public const string SQLCOL_TITLE = "Title";
        public const string SQLCOL_TEXT = "Text";
        public const string SQLCOL_MESSAGESTATUS = "MessageStatus";
        public const string SQLCOL_LASTOPERATIONTIME = "LastOperationTime";
        public const string SQLCOL_SENDERNAME = "SenderName";
        public const string SQLCOL_SENDERDISPLAYNAME = "SenderDisplayName";
        public const string SQLCOL_RECEIVERS = "Receivers";
        public const string SQLCOL_SENDTIME = "SendTime";
        public const string SQLCOL_PROCESSSTATUS = "ProcessStatus";
        public const string SQLCOL_PROCESSTIME = "ProcessTime";
        public const string SQLCOL_PROCESSCOUNT = "ProcessCount";
        public const string SQLCOL_TAG = "Tag";
        public const string SQLCOL_NEEDFEEDBACK = "NeedFeedBack";
        public const string SQLCOL_NOTIFYURL = "NotifyUrl";
        public const string SQLCOL_TIMEOUT = "TimeOut";
        public const string SQLCOL_PRIORITY = "Priority";
        public const string SQLCOL_FEEDBACKSTATUS = "FeedBackStatus";
        public const string SQLCOL_FEEDBACKFORWARD = "FeedBackForward";
        public const string SQLCOL_QUEUEID = "QueueID";
        public const string SQLCOL_MESSAGETEXT = "MessageText";
        public const string SQLCOL_MESSAGETITLE = "MessageTitle";
        public const string SQLCOL_DEVICEID = "DeviceID";
        public const string SQLCOL_POOLID = "PoolID";
        public const string SQLCOL_QUEUESTATUS = "QueueStatus";
        public const string SQLCOL_QUEUELASTOPERATIONTIME = "QueueLastOperationTime";
        public const string SQLCOL_QUEUESENDERNAME = "QueueSenderName";
        public const string SQLCOL_QUEUESENDERDISPLAYNAME = "QueueSenderDisplayName";
        public const string SQLCOL_RECEIVERNAME = "ReceiverName";
        public const string SQLCOL_RECEIVERDISPLAYNAME = "ReceiverDisplayName";
        public const string SQLCOL_RECEIVERCONTACT = "ReceiverContact";
        public const string SQLCOL_QUEUEPROCESSSTATUS = "QueueProcessStatus";
        public const string SQLCOL_QUEUEPROCESSTIME = "QueueProcessTime";
        public const string SQLCOL_QUEUEPROCESSCOUNT = "QueueProcessCount";
        public const string SQLCOL_GOTTIME = "GotTime";
        public const string SQLCOL_QUEUESENDTIME = "QueueSendTime";
        public const string SQLCOL_QUEUEREADTIME = "QueueReadTime";
        public const string SQLCOL_QUEUEPRIORITY = "QueuePriority";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public VMessageQueue() { }

        #endregion

        public override void Init(DataRow row)
        {
            MessageID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_MESSAGEID]);
            CreateTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_CREATETIME]);
            ModuleID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_MODULEID]);
            Title = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_TITLE]);
            Text = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_TEXT]);
            MessageStatus = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_MESSAGESTATUS]);
            LastOperationTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_LASTOPERATIONTIME]);
            SenderName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_SENDERNAME]);
            SenderDisplayName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_SENDERDISPLAYNAME]);
            Receivers = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_RECEIVERS]);
            SendTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_SENDTIME]);
            ProcessStatus = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_PROCESSSTATUS]);
            ProcessTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_PROCESSTIME]);
            ProcessCount = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_PROCESSCOUNT]);
            Tag = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_TAG]);
            NeedFeedBack = (bool)ObjectType.BooleanTypeHelper.Read(row[SQLCOL_NEEDFEEDBACK]);
            NotifyUrl = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_NOTIFYURL]);
            TimeOut = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_TIMEOUT]);
            Priority = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_PRIORITY]);
            FeedBackStatus = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_FEEDBACKSTATUS]);
            FeedBackForward = (bool)ObjectType.BooleanTypeHelper.Read(row[SQLCOL_FEEDBACKFORWARD]);
            QueueID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_QUEUEID]);
            MessageText = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_MESSAGETEXT]);
            MessageTitle = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_MESSAGETITLE]);
            DeviceID = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_DEVICEID]);
            PoolID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_POOLID]);
            QueueStatus = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_QUEUESTATUS]);
            QueueLastOperationTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_QUEUELASTOPERATIONTIME]);
            QueueSenderName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_QUEUESENDERNAME]);
            QueueSenderDisplayName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_QUEUESENDERDISPLAYNAME]);
            ReceiverName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_RECEIVERNAME]);
            ReceiverDisplayName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_RECEIVERDISPLAYNAME]);
            ReceiverContact = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_RECEIVERCONTACT]);
            QueueProcessStatus = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_QUEUEPROCESSSTATUS]);
            QueueProcessTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_QUEUEPROCESSTIME]);
            QueueProcessCount = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_QUEUEPROCESSCOUNT]);
            GotTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_GOTTIME]);
            QueueSendTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_QUEUESENDTIME]);
            QueueReadTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_QUEUEREADTIME]);
            QueuePriority = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_QUEUEPRIORITY]);
        }

        #region Properties
        #region Property <Guid> MessageID
        [Property("MessageID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid MessageID
        {
            get { return _MessageID; }
            set { _MessageID = value; }
        }
        private Guid _MessageID = Guid.Empty;
        #endregion

        #region Property <DateTime> CreateTime
        [Property("CreateTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime CreateTime
        {
            get { return _CreateTime; }
            set { _CreateTime = value; }
        }
        private DateTime _CreateTime = DateTime.MinValue;
        #endregion

        #region Property <Guid> ModuleID
        [Property("ModuleID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid ModuleID
        {
            get { return _ModuleID; }
            set { _ModuleID = value; }
        }
        private Guid _ModuleID = Guid.Empty;
        #endregion

        #region Property <string> Title
        [Property("Title", 2000, SqlDbType.NVarChar, false, false)]
        public string Title
        {
            get { return _Title; }
            set { _Title = value; }
        }
        private string _Title = null;
        #endregion

        #region Property <string> Text
        [Property("Text", 2147483646, SqlDbType.NText, false, false)]
        public string Text
        {
            get { return _Text; }
            set { _Text = value; }
        }
        private string _Text = null;
        #endregion

        #region Property <int> MessageStatus
        [Property("MessageStatus", 4, SqlDbType.Int, false, false)]
        public int MessageStatus
        {
            get { return _MessageStatus; }
            set { _MessageStatus = value; }
        }
        private int _MessageStatus = int.MinValue;
        #endregion

        #region Property <DateTime> LastOperationTime
        [Property("LastOperationTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime LastOperationTime
        {
            get { return _LastOperationTime; }
            set { _LastOperationTime = value; }
        }
        private DateTime _LastOperationTime = DateTime.MinValue;
        #endregion

        #region Property <string> SenderName
        [Property("SenderName", 100, SqlDbType.NVarChar, false, false)]
        public string SenderName
        {
            get { return _SenderName; }
            set { _SenderName = value; }
        }
        private string _SenderName = null;
        #endregion

        #region Property <string> SenderDisplayName
        [Property("SenderDisplayName", 100, SqlDbType.NVarChar, false, false)]
        public string SenderDisplayName
        {
            get { return _SenderDisplayName; }
            set { _SenderDisplayName = value; }
        }
        private string _SenderDisplayName = null;
        #endregion

        #region Property <string> Receivers
        [Property("Receivers", 2147483646, SqlDbType.NText, false, false)]
        public string Receivers
        {
            get { return _Receivers; }
            set { _Receivers = value; }
        }
        private string _Receivers = null;
        #endregion

        #region Property <DateTime> SendTime
        [Property("SendTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime SendTime
        {
            get { return _SendTime; }
            set { _SendTime = value; }
        }
        private DateTime _SendTime = DateTime.MinValue;
        #endregion

        #region Property <int> ProcessStatus
        [Property("ProcessStatus", 4, SqlDbType.Int, false, false)]
        public int ProcessStatus
        {
            get { return _ProcessStatus; }
            set { _ProcessStatus = value; }
        }
        private int _ProcessStatus = int.MinValue;
        #endregion

        #region Property <DateTime> ProcessTime
        [Property("ProcessTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime ProcessTime
        {
            get { return _ProcessTime; }
            set { _ProcessTime = value; }
        }
        private DateTime _ProcessTime = DateTime.MinValue;
        #endregion

        #region Property <int> ProcessCount
        [Property("ProcessCount", 4, SqlDbType.Int, false, false)]
        public int ProcessCount
        {
            get { return _ProcessCount; }
            set { _ProcessCount = value; }
        }
        private int _ProcessCount = int.MinValue;
        #endregion

        #region Property <string> Tag
        [Property("Tag", 2147483646, SqlDbType.NText, false, false)]
        public string Tag
        {
            get { return _Tag; }
            set { _Tag = value; }
        }
        private string _Tag = null;
        #endregion

        #region Property <bool> NeedFeedBack
        [Property("NeedFeedBack", 1, SqlDbType.Bit, false, false)]
        public bool NeedFeedBack
        {
            get { return _NeedFeedBack; }
            set { _NeedFeedBack = value; }
        }
        private bool _NeedFeedBack = false;
        #endregion

        #region Property <string> NotifyUrl
        [Property("NotifyUrl", 2147483646, SqlDbType.NText, false, false)]
        public string NotifyUrl
        {
            get { return _NotifyUrl; }
            set { _NotifyUrl = value; }
        }
        private string _NotifyUrl = null;
        #endregion

        #region Property <DateTime> TimeOut
        [Property("TimeOut", 16, SqlDbType.DateTime, false, false)]
        public DateTime TimeOut
        {
            get { return _TimeOut; }
            set { _TimeOut = value; }
        }
        private DateTime _TimeOut = DateTime.MinValue;
        #endregion

        #region Property <int> Priority
        [Property("Priority", 4, SqlDbType.Int, false, false)]
        public int Priority
        {
            get { return _Priority; }
            set { _Priority = value; }
        }
        private int _Priority = int.MinValue;
        #endregion

        #region Property <int> FeedBackStatus
        [Property("FeedBackStatus", 4, SqlDbType.Int, false, false)]
        public int FeedBackStatus
        {
            get { return _FeedBackStatus; }
            set { _FeedBackStatus = value; }
        }
        private int _FeedBackStatus = int.MinValue;
        #endregion

        #region Property <bool> FeedBackForward
        [Property("FeedBackForward", 1, SqlDbType.Bit, false, false)]
        public bool FeedBackForward
        {
            get { return _FeedBackForward; }
            set { _FeedBackForward = value; }
        }
        private bool _FeedBackForward = false;
        #endregion

        #region Property <Guid> QueueID
        [Property("QueueID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid QueueID
        {
            get { return _QueueID; }
            set { _QueueID = value; }
        }
        private Guid _QueueID = Guid.Empty;
        #endregion

        #region Property <string> MessageText
        [Property("MessageText", 2147483646, SqlDbType.NText, false, false)]
        public string MessageText
        {
            get { return _MessageText; }
            set { _MessageText = value; }
        }
        private string _MessageText = null;
        #endregion

        #region Property <string> MessageTitle
        [Property("MessageTitle", 2000, SqlDbType.NVarChar, false, false)]
        public string MessageTitle
        {
            get { return _MessageTitle; }
            set { _MessageTitle = value; }
        }
        private string _MessageTitle = null;
        #endregion

        #region Property <int> DeviceID
        [Property("DeviceID", 4, SqlDbType.Int, false, false)]
        public int DeviceID
        {
            get { return _DeviceID; }
            set { _DeviceID = value; }
        }
        private int _DeviceID = int.MinValue;
        #endregion

        #region Property <Guid> PoolID
        [Property("PoolID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid PoolID
        {
            get { return _PoolID; }
            set { _PoolID = value; }
        }
        private Guid _PoolID = Guid.Empty;
        #endregion

        #region Property <int> QueueStatus
        [Property("QueueStatus", 4, SqlDbType.Int, false, false)]
        public int QueueStatus
        {
            get { return _QueueStatus; }
            set { _QueueStatus = value; }
        }
        private int _QueueStatus = int.MinValue;
        #endregion

        #region Property <DateTime> QueueLastOperationTime
        [Property("QueueLastOperationTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime QueueLastOperationTime
        {
            get { return _QueueLastOperationTime; }
            set { _QueueLastOperationTime = value; }
        }
        private DateTime _QueueLastOperationTime = DateTime.MinValue;
        #endregion

        #region Property <string> QueueSenderName
        [Property("QueueSenderName", 100, SqlDbType.NVarChar, false, false)]
        public string QueueSenderName
        {
            get { return _QueueSenderName; }
            set { _QueueSenderName = value; }
        }
        private string _QueueSenderName = null;
        #endregion

        #region Property <string> QueueSenderDisplayName
        [Property("QueueSenderDisplayName", 100, SqlDbType.NVarChar, false, false)]
        public string QueueSenderDisplayName
        {
            get { return _QueueSenderDisplayName; }
            set { _QueueSenderDisplayName = value; }
        }
        private string _QueueSenderDisplayName = null;
        #endregion

        #region Property <string> ReceiverName
        [Property("ReceiverName", 100, SqlDbType.NVarChar, false, false)]
        public string ReceiverName
        {
            get { return _ReceiverName; }
            set { _ReceiverName = value; }
        }
        private string _ReceiverName = null;
        #endregion

        #region Property <string> ReceiverDisplayName
        [Property("ReceiverDisplayName", 100, SqlDbType.NVarChar, false, false)]
        public string ReceiverDisplayName
        {
            get { return _ReceiverDisplayName; }
            set { _ReceiverDisplayName = value; }
        }
        private string _ReceiverDisplayName = null;
        #endregion

        #region Property <string> ReceiverContact
        [Property("ReceiverContact", 200, SqlDbType.NVarChar, false, false)]
        public string ReceiverContact
        {
            get { return _ReceiverContact; }
            set { _ReceiverContact = value; }
        }
        private string _ReceiverContact = null;
        #endregion

        #region Property <int> QueueProcessStatus
        [Property("QueueProcessStatus", 4, SqlDbType.Int, false, false)]
        public int QueueProcessStatus
        {
            get { return _QueueProcessStatus; }
            set { _QueueProcessStatus = value; }
        }
        private int _QueueProcessStatus = int.MinValue;
        #endregion

        #region Property <DateTime> QueueProcessTime
        [Property("QueueProcessTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime QueueProcessTime
        {
            get { return _QueueProcessTime; }
            set { _QueueProcessTime = value; }
        }
        private DateTime _QueueProcessTime = DateTime.MinValue;
        #endregion

        #region Property <int> QueueProcessCount
        [Property("QueueProcessCount", 4, SqlDbType.Int, false, false)]
        public int QueueProcessCount
        {
            get { return _QueueProcessCount; }
            set { _QueueProcessCount = value; }
        }
        private int _QueueProcessCount = int.MinValue;
        #endregion

        #region Property <DateTime> GotTime
        [Property("GotTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime GotTime
        {
            get { return _GotTime; }
            set { _GotTime = value; }
        }
        private DateTime _GotTime = DateTime.MinValue;
        #endregion

        #region Property <DateTime> QueueSendTime
        [Property("QueueSendTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime QueueSendTime
        {
            get { return _QueueSendTime; }
            set { _QueueSendTime = value; }
        }
        private DateTime _QueueSendTime = DateTime.MinValue;
        #endregion

        #region Property <DateTime> QueueReadTime
        [Property("QueueReadTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime QueueReadTime
        {
            get { return _QueueReadTime; }
            set { _QueueReadTime = value; }
        }
        private DateTime _QueueReadTime = DateTime.MinValue;
        #endregion

        #region Property <int> QueuePriority
        [Property("QueuePriority", 4, SqlDbType.Int, false, false)]
        public int QueuePriority
        {
            get { return _QueuePriority; }
            set { _QueuePriority = value; }
        }
        private int _QueuePriority = int.MinValue;
        #endregion
        #endregion
    }
}
